﻿using Aliphant.Net.Client.Network;

namespace Aliphant.Net.Client
{
    public abstract class ClientBase
    {
        public abstract string Ip { get; }

        public abstract string Port { get; }

        public bool IsConnected { get; set; }

        public virtual void Connect()
        {
            if (IsConnected)
                NetClient.Instance.CloseConnection();

            NetClient.Instance.Connected(Ip, Port);
            IsConnected = NetClient.Instance.IsConnected;
        }

        public abstract void Start();

        public virtual void Update()
        {
            NetClient.Instance.Update();
        }

        public abstract void Stop();

        public virtual void Exit()
        {
            Stop();
        }
    }
}
